<?php
/**
 * Created by PhpStorm.
 * User: mac
 * Date: 16/9/4
 * Time: 下午9:22
 */

namespace app\wap\controller;


use think\Controller;
use think\Db;
use think\Request;

class Article extends Controller
{

    public function articleList(){
        $model = new \app\wap\model\Article();
        $rs = $model->where("ishot",1)->limit(5)->order("id","desc")->select();
        $this->assign("hots",$rs);
        $this->assign("news",$model::all(['ishot'=>1]));
        return view();
    }


    public function about(){
        return view();
    }

    public function feedback(){
        return view();
    }

    public function articleInfo(){
        $model = new \app\wap\model\Article();
        $id = Request::instance()->param('id');
        $this->assign("article",$model::get(['id'=>$id]));
        return view();
    }

    public function feedbackDo(){
        $data = [
            'title' => Request::instance()->post('title'),
            'contact' => Request::instance()->post('contact'),
            'content' => Request::instance()->post('content'),
            'addtime' => time(),
        ];
        Db::name('feedback')->insert($data);
        return view();
    }
}
